import os

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

# 打开浏览器，请求测试网址
driver=webdriver.Chrome()
url='file:///' + os.path.abspath('html') +'/radio-checkbox.html'
driver.get(url)

#单选
driver.find_element(By.ID,'boy').click()
print(driver.find_element(By.ID, 'boy').is_selected())
time.sleep(2)
driver.find_element(By.ID,'girl').click()

#判断是否选中,选中返回True,否则返回False
print(driver.find_element(By.ID, 'girl').is_selected())


#多选
time.sleep(3)
form=driver.find_elements(By.TAG_NAME,'form')[1]
ipts=driver.find_elements(By.TAG_NAME,'input')
for ipt in ipts:
    ipt.click()

#退出
time.sleep(3)
driver.quit()



